package com.hwy.jmh.json.impl;

import com.google.gson.Gson;
import com.hwy.jmh.json.Json;

/**
 * @Author hweiyu
 * @Description
 * @Date 2022/2/7 17:19
 */
public class GsonImpl implements Json {

    private Gson gson = new Gson();

    @Override
    public String toStr(Object obj) {
        return gson.toJson(obj);
    }

    @Override
    public Object toBean(String str, Class cls) {
        return gson.fromJson(str, cls);
    }
}
